<!DOCTYPE html>
<html lang="en" class="html">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>

    <style>
        .active{
            border: 1px solid red;
        }
       
        .box2{
            height: 300px;
            width: 200px;
            background-color: bisque;
        }
        .box{
            height: 300px;
            width: 300px;
            background-color: aquamarine;
        }
        .html{
            background-color:blue
            ;
        }
    </style>
</head>
<body>
    <!-- v-bind指令 
        v-bind指令的作用是为元素绑定属性
        完整写法是v-bind:属性名
        简写的话可以直接省略v-bind，只保留 :属性名
     -->
    <div id="app">
        <div  class="box2"  :class="{box:isActive} ">1213</div>
        <button @click="change" value="clike">123</button>
        <!-- 全写：v-bind:src
        <img v-bind:src="imgSrc" v-bind:title="imgTitle" alt="">
        <br>
        简写 ：src
        <img :src="imgSrc" :title="imgTitle + '!!!!'" alt="">
        <br>
        添加类_三元表达式
        <button @click="toggleActive">点击我改变class属性</button>
        <img :src="imgSrc" :title="imgTitle + '!!!!'" :class="isActive?'active':''" alt="">
        <br>
        添加类_对象方式
        <button @click="toggleActive">点击我改变class属性</button>
        <img :src="imgSrc" :title="imgTitle + '!!!!'" :class="{active:isActive}" alt=""> -->

    </div>

    <script>
        var app = new Vue({
            el:'#app',
            data:{
                imgSrc:"http://www.itheima.com/images/logo.png",
                imgTitle:"黑马程序员",
                isActive:false
            },
            methods:{
                change:function(){
                    this.isActive=!this.isActive;
                }
            }
          
        });
    </script>
</body>
</html>
